

const myPromise = new Promise(function (resolve,reject) {
    // 异步操作，成功时调用 resolve，失败时调用 reject
    // 例如：异步加载数据，定时器等
    setTimeout(() => {
        const success = true;
        if (success) {
            resolve("Operation was successful","aa");
        } else {
            reject("Operation failed");
        }
    }, 1000);
});


myPromise.then((result, c) => {
        // 在操作成功时调用，接收 resolve 传递的值
        console.log(result);
        console.log(c);
    })
    .catch((error) => {
        // 在操作失败时调用，接收 reject 传递的值
        console.error(error);
    })
    .finally(() => {
        // 无论成功或失败都会执行
        console.log("Operation completed");
    });


window.top._T2IMPRINTDB
